package com.xlt.activiti.two;

import com.xlt.activiti.bean.Holiday;
import org.activiti.engine.ProcessEngine;
import org.activiti.engine.ProcessEngines;
import org.activiti.engine.RuntimeService;
import org.activiti.engine.runtime.ProcessInstance;

import java.util.HashMap;
import java.util.Map;

public class ActivitiAssigneeUEL {
    public static void assignee(String key, Map<String,Object> map){
        // 1.创建ProcessEngine对象
        ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
        // 2.runtimeService
        RuntimeService runtimeService = processEngine.getRuntimeService();

        ProcessInstance processInstance;
        if (map!=null){
            processInstance = runtimeService.startProcessInstanceByKey(key, map);
        }else {
            processInstance = runtimeService.startProcessInstanceByKey(key);
        }

        System.out.println(processInstance.getId());
    }

}
